package minotaur.stat;

public class Stat implements StatObservable {

    private java.util.List<StatNotifiable> subscribers;
    private int value;
    private StatType type;
    
    public int getValue() {
        return value;
    }
    
    public void update( int differential ) {
        value += differential;
    }
    
    public void register( StatNotifiable sn ) {
        subscribers.add(sn);
    }
    
    public void notifyAllNotifiables() {
        java.util.Iterator<StatNotifiable> iter = subscribers.iterator();
        
        while(iter.hasNext()) {
            iter.next().derive(type, value);
        }
        
    }
}
